#ifndef __H_LINK__
#define __H_LINK__

namespace bl{

typedef struct SLINK
{
	SLINK* next;
}SLINK, *PSLINK;


#define Slink_Initialize(head) ((head)->next = NULL)

#define Slink_IsEmpty(head)  ((head)->next == NULL)

#define Slink_Pop(head) (head)->next; (head)->next = (head)->next->next;

#define Slink_Push(head, link)  (link)->next = (head)->next; (head)->next = (link);



typedef struct DLINK
{
	DLINK* prev;
	DLINK* next;
}DLINK, *PDLINK;


#define Dlink_Initialize(head)  ( (head)->next = (head)->prev = (head) )

#define Dlink_IsEmpty(head)  ( (head)->next == (head) )

#define Dlink_InsertNext(head, dlink)  (dlink)->next = (head)->next; (dlink)->prev = (head); (head)->next->prev = (dlink); (head)->next = (dlink);

#define Dlink_InsertBefore(head, dlink) (dlink)->prev = (head)->prev; (dlink)->next = (head); (head)->prev->next = (dlink); (head)->prev = (dlink);

#define Dlink_Remove(dlink)  (dlink)->prev->next = (dlink)->next; (dlink)->next->prev = (dlink)->prev;


}

#endif